pp108 : Triggering Rules from a Business Process Model

Triggering Rules from a Business Process Model

This topic describes the procedure to trigger rules from a business process model.

In a Business Process Model, you can model activity behavior using rules, developed in WS-AppServer. You can build rules on the WS-AppServer generated templates and enhance your application's functionality, thereby streamlining the business process.

  1. Create WS-AppServer Service Container and point it to your database. Ensure that you have selected Enable Rules checkbox when you create the WS-AppServer Service Container.
  2. Create a Database Metadata to get tables from database to the Process Platform environment.
  3. Create a WS-AppServer package. Generate Web services for this package. WS-AppServer templates are generated along with the package.
  4. Build a rule on a WS-AppServer template. Rules can be triggered on insert, update, or delete.
  5. Select a starting point and click (Business Process Model) to open a business process model.
  6. From Workspace Documents> <Solution> > <Project>, drag the required Web service on to the business process model.
  7. Select the Web service activity and click Message Map tab on the toolbar. The message map for the Web service activity appears.
  8. Do one of the following to create an assignment:
    • Drag the source element from the Source column and drop it on the left box in the Assignments column. Likewise, drag the target element from the Target column and drop it on the left box in the Assignments column.
    • Right-click the element or message in the Target column, and select Create Assignment.

      Note:
      By default, this creates a Fixed Value assignment.

  9. Complete the Message Map assignments for other activities in the process model.
  10. Configure the other constructs used in the process model.
  11. Right-click in the business process modeling environment and select Business Process Execution> Validate and generate BPML.
    Alternatively, go to Workspace Documents <project>, right-click the <business process model> and select Business Process Execution> Validate and generate BPML. If there are no warnings, a status message appears indicating that there are no warnings. If there are warnings resolve them and re-validate the business process model.
  12. Right-click in the business process modeling environment and select Business Process Execution> Publish to Organization.
    Alternatively, go to Workspace Documents <project>, right-click the <business process model> and select Publish to Organization. The business process model is published to organization.
  13. Right-click in the business process modeling environment and select Business Process Execution> Run. The business process model is instantiated.

Rule is triggered from a BPM.

Example of Triggering Rules from a Business Process Model

The following example describes the procedure to use a rule from a business process model to decide the salary of a new candidate, Software Engineer, based on his work experience, and skillsetrating. Salary of the candidate is determined based on a rule: if employee experience is >= 3 years, and employee skillsetrating is >= 5, then assign employee salary as 6.0 K, else if employee experience < 3 years, and employee skillsetrating is <= 5, then assign employee salary as 4.0 K.

Business Requirements
The business process should satisfy the following requirements:

  1. A WS-AppServer Service Container.
  2. A Database Metadata.
  3. A WS-AppServer package and Web services generated.
  4. A rule created on WS-AppServer template.
  5. A business process model to use the rule.

Prerequisites
Ensure that:

  1. A WS-AppServer Service Container is created and pointed to your database. Ensure that you have selected Enable Rules check box when you create the WS-AppServer Service Container.
  2. A Database Metadata, Database Metadata is created to get tables from database to the Process Platform environment.
  3. A WS-AppServer package is created and the Web services are generated on this package. Ensure that UpdateEmployee Web service is generated. WS-AppServer templates are generated along with the package.
  4. A rule group, EmpRule Group is created and a rule EmpSalRule is built on Employee Model.

Triggering Rules from a business process model

  1. Create a simple BPM, CalEmpSalary as follows:
  2. Drag the generated UpdateEmployee Web service on to the business process modeling environment. You may note that when you drag UpdateEmployee on to the business process model, an input, UpdateEmployeeInput and output, UpdateEmployeeOutput and UpdateEmployeeFaultDetail are also created.
  3. Drag the UpdateEmployeeOutput on to the End event of the business process model.
  4. Design the business process model that appears as follows.
  5. Right-click in the business process modeling environment and select Business Process Execution> Validate and generate BPML. If there are any warnings they appear in the Warning List pane.
  6. If there are no warnings, right-click in the business process modeling environment and select Business Process Execution> Publish to Organization.
  7. Right-click in the business process modeling environment and select Business Process Execution> Run.
  8. Right-click in the business process modeling environment and select Business Process Execution> Show Process Instances. Instances by Process Definition window appears.
  9. In the Instances by Process Definition window, right-click Complete under Status column, and choose Show End Message to view the employee salary. Object Details dialog appears with 6.0 K, as the employee salary:

The salary of the employee is determined by triggering rules in a business process model.



Related tasks

Invoking a Web service in Rules
Triggering a Business Process from Rules
Using a Business Rule in an XForm
Using WS-AppServer Business Logic in XForms